home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / THINKPas Univ Hdr 2.1 / Interfaces / TranslationExtensions.p < prev    next >
Text File  |  1995-09-13  |  6KB  |  170 lines

  1. { Converted with MPW2TPas Tuesday, September 12, 1995 11:03:49 PM }
  2. {
  3.      File:        TranslationExtensions.p
  4.  
  5.      Contains:    Macintosh Easy Open Translation Extension Interfaces.
  6.  
  7.      Version:    Technology:    Macintosh Easy Open 1.1
  8.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  9.  
  10.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14.                  stack.  Include the file and version information (from above)
  15.                  in the problem description and send to:
  16.                      Internet:    apple.bugs@applelink.apple.com
  17.                      AppleLink:    APPLE.BUGS
  18.  
  19. }
  20.  
  21.  UNIT TranslationExtensions;
  22.  INTERFACE
  23.  
  24.  
  25. {$IFC UNDEFINED __TRANSLATIONEXTENSIONS__}
  26. {$SETC __TRANSLATIONEXTENSIONS__ := 1}
  27.  
  28.   USES
  29.    ConditionalMacros, Types, Memory, Files, Quickdraw, Components;
  30.  
  31. { $PUSH}
  32. { $ALIGN MAC68K}
  33. { $LibExport+}
  34.  
  35. CONST
  36.     kSupportsFileTranslation    = 1;
  37.     kSupportsScrapTranslation    = 2;
  38.     kTranslatorCanGenerateFilename = 4;
  39.  
  40.     
  41. TYPE
  42.     FileType = OSType;
  43.  
  44.     ScrapType = ResType;
  45.  
  46.     TranslationAttributes = LONGINT;
  47.  
  48.  
  49. CONST
  50.     taDstDocNeedsResourceFork    = 1;
  51.     taDstIsAppTranslation        = 2;
  52.  
  53.  
  54. TYPE
  55.     FileTypeSpec = RECORD
  56.         format:                    FileType;
  57.         hint:                    LONGINT;
  58.         flags:                    TranslationAttributes;                    { taDstDocNeedsResourceFork, taDstIsAppTranslation}
  59.         catInfoType:            OSType;
  60.         catInfoCreator:            OSType;
  61.     END;
  62.  
  63.     FileTranslationList = RECORD
  64.         modDate:                LONGINT;
  65.         groupCount:                LONGINT;
  66.         {     unsigned long    group1SrcCount;}
  67.         {     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);}
  68.         {  FileTypeSpec    group1SrcTypes[group1SrcCount]}
  69.         {  unsigned long    group1DstCount;}
  70.         {  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);}
  71.         {  FileTypeSpec    group1DstTypes[group1DstCount]}
  72.     END;
  73.  
  74.     FileTranslationListPtr = ^FileTranslationList;
  75.     FileTranslationListHandle = ^FileTranslationListPtr;
  76.  
  77.     ScrapTypeSpec = RECORD
  78.         format:                    ScrapType;
  79.         hint:                    LONGINT;
  80.     END;
  81.  
  82.     ScrapTranslationList = RECORD
  83.         modDate:                LONGINT;
  84.         groupCount:                LONGINT;
  85.         {     unsigned long        group1SrcCount;}
  86.         {     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);}
  87.         {  ScrapTypeSpec        group1SrcTypes[group1SrcCount]}
  88.         {  unsigned long        group1DstCount;}
  89.         {     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);}
  90.         {  ScrapTypeSpec        group1DstTypes[group1DstCount]}
  91.     END;
  92.  
  93.     ScrapTranslationListPtr = ^ScrapTranslationList;
  94.     ScrapTranslationListHandle = ^ScrapTranslationListPtr;
  95.  
  96. { definition of callbacks to update progress dialog}
  97.     TranslationRefNum = LONGINT;
  98.  
  99. {****************************************************************************************
  100. *
  101. * This routine sets the advertisement in the top half of the progress dialog.
  102. * It is called once at the beginning of your DoTranslateFile routine.
  103. *
  104. * Enter:    refNum            Translation reference supplied to DoTranslateFile.
  105. *            advertisement    A handle to the picture to display.  This must be non-purgable.
  106. *                            Before returning from DoTranslateFile, you should dispose
  107. *                            of the memory.  (Normally, it is in the temp translation heap
  108. *                            so it is cleaned up for you.)
  109. *
  110. * Exit:    returns            noErr, paramErr, or memFullErr
  111. }
  112.  
  113. FUNCTION SetTranslationAdvertisement(refNum: TranslationRefNum; advertisement: PicHandle): OSErr;
  114.     {$IFC NOT GENERATINGCFM}
  115.     INLINE $7002, $ABFC;
  116.     {$ENDC}
  117. {****************************************************************************************
  118. *
  119. * This routine updates the progress bar in the progress dialog.
  120. * It is called repeatedly from within your DoTranslateFile routine.
  121. * It should be called often, so that the user will get feedback if he tries to cancel.
  122. *
  123. * Enter:    refNum        translation reference supplied to DoTranslateFile.
  124. *            progress    percent complete (0-100)
  125. *
  126. * Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  127. *            returns        noErr, paramErr, or memFullErr
  128. }
  129. FUNCTION UpdateTranslationProgress(refNum: TranslationRefNum; percentDone: INTEGER; VAR canceled: BOOLEAN): OSErr;
  130.     {$IFC NOT GENERATINGCFM}
  131.     INLINE $7001, $ABFC;
  132.     {$ENDC}
  133. { ComponentMgr selectors for routines}
  134.  
  135. CONST
  136.     kTranslateGetFileTranslationList = 0;                        { component selectors}
  137.     kTranslateIdentifyFile        = 1;
  138.     kTranslateTranslateFile        = 2;
  139.     kTranslateGetTranslatedFilename = 3;
  140.     kTranslateGetScrapTranslationList = 10;                        { skip to scrap routines}
  141.     kTranslateIdentifyScrap        = 11;
  142.     kTranslateTranslateScrap    = 12;
  143.  
  144. { Routines to implment in a file translation extension}
  145. TYPE
  146.     DoGetFileTranslationListProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; translationList: FileTranslationListHandle): ComponentResult; }
  147.  
  148.     DoIdentifyFileProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; (CONST)VAR theDocument: FSSpec; VAR docType: FileType): ComponentResult; }
  149.  
  150.     DoTranslateFileProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; refNum: TranslationRefNum; (CONST)VAR sourceDocument: FSSpec; srcType: FileType; srcTypeHint: LONGINT; (CONST)VAR dstDoc: FSSpec; dstType: FileType; dstTypeHint: LONGINT): ComponentResult; }
  151.  
  152.     DoGetTranslatedFilenameProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; dstType: FileType; dstTypeHint: LONGINT; VAR theDocument: FSSpec): ComponentResult; }
  153.  
  154. { Routine to implement in a scrap translation extension}
  155.     DoGetScrapTranslationListProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; list: ScrapTranslationListHandle): ComponentResult; }
  156.  
  157.     DoIdentifyScrapProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; dataPtr: UNIV Ptr; dataLength: Size; VAR dataFormat: ScrapType): ComponentResult; }
  158.  
  159.     DoTranslateScrapProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; refNum: TranslationRefNum; srcDataPtr: UNIV Ptr; srcDataLength: Size; srcType: ScrapType; srcTypeHint: LONGINT; dstData: Handle; dstType: ScrapType; dstTypeHint: LONGINT): ComponentResult; }
  160.  
  161.  
  162. { $ALIGN RESET}
  163. { $POP}
  164.  
  165. {$ENDC} {__TRANSLATIONEXTENSIONS__}
  166.  
  167.  IMPLEMENTATION
  168.  END.
  169.  
  170.